<% layout('/layouts/default.html', {title: '任务过程审核-任务反馈审核', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="inputForm" model="${dcSupTaskAudit}" action="${ctx}/audit/dcSupTaskAudit/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('任务信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('任务年度')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">${dcSupTaskAudit.dcSupTaskInfo.taskYear}年</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('任务类型')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.taskTypeName}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">${text('任务标题')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left;white-space: pre-line;">${text(dcSupTaskAudit.dcSupTaskInfo.taskTitle)}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">${text('任务内容')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left;white-space: pre-line;">${text(dcSupTaskAudit.dcSupTaskInfo.taskContent)}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">${text('起止时间')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${text(@DateUtils.formatDate(dcSupTaskAudit.dcSupTaskInfo.taskStartTime,'yyyy-MM-dd HH:mm'))}</label>
								至
								<label class="control-label " title="" style="text-align: left">${text(@DateUtils.formatDate(dcSupTaskAudit.dcSupTaskInfo.taskEndTime,'yyyy-MM-dd HH:mm'))}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('督办要求')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" title="" style="text-align: left;white-space: pre-line;">${dcSupTaskAudit.dcSupTaskInfo.taskRequireName!'无'}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<% if(dcSupTaskAudit.dcSupTaskInfo.normalFlag == '2'){ %>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('协同单位')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.taskCoopOrgName!'无'}</label>
							</div>
						</div>
					</div>
					<% } %>
					<% if(dcSupTaskAudit.dcSupTaskInfo.normalFlag == '2'){ %>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('督办人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.taskSupUserName!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('督办科室')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.taskSupOrgName!'无'}</label>
							</div>
						</div>
					</div>
					<% } %>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('牵头领导')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.taskLeaderName!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('牵头责任单位')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.taskLeaderOrgName!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('联系人')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.contactName!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('联系电话')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.contactPhone!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('反馈要求')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left;white-space: pre-line;">${dcSupTaskAudit.dcSupTaskInfo.feedbackWay!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('督办字号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" title="" style="text-align: left">${dcSupTaskAudit.dcSupTaskInfo.messageNumber!'无'}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required hide">*</span> ${text('附件上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile" bizKey="${dcSupTaskAudit.dcSupTaskInfo.id}" bizType="dcSupTaskInfo_file"
								uploadType="all" class="" readonly="true" preview="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('反馈信息')}</div>
				<% if (dcSupTaskAudit.dcSupTaskFeedback.feedbackRequire!=null){ %>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('阶段目标')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">${dcSupTaskAudit.dcSupTaskFeedback.feedbackRequire!'无'}</label>
							</div>
						</div>
					</div>
				</div>
				<% } %>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('反馈截止时间')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">${text(@DateUtils.formatDate(dcSupTaskAudit.dcSupTaskFeedback.feedbackEndTime,'yyyy-MM-dd HH:mm'))}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">${text('最新进展情况')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left;white-space: pre-line;">${text(dcSupTaskAudit.dcSupTaskFeedback.feedbackContent)}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">${text('存在问题')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left;white-space: pre-line;">${text(dcSupTaskAudit.dcSupTaskFeedback.feedbackAdvice)}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">${text('拟采取的工作举措')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left;white-space: pre-line;">${text(dcSupTaskAudit.dcSupTaskFeedback.feedbackMeasure)}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('完成进度')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">
									<#form:radio path="feedbackProgress" dictType="dc_feedback_progress" defaultValue="${dcSupTaskAudit.dcSupTaskFeedback.feedbackProgress}" class="form-control required"/>
								</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> 完成率：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<div class="input-group">
									<#form:input path="feedbackRate" type="number" onblur="testRegx(this)" max="100" data-msg-rangelength="最大值100" dataFormat="number2" class="form-control"/>
									<span class="input-group-addon">%</span>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('反馈人')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">${dcSupTaskAudit.dcSupTaskFeedback.feedbackName!'无'}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('反馈单位')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">${dcSupTaskAudit.taskLeaderOrgName!'无'}</label>
							</div>
						</div>
					</div>

				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">${text('反馈人电话')}：</label>
							<div class="col-sm-8">
								<label class="control-label " title="">${dcSupTaskAudit.dcSupTaskFeedback.feedbackPhone!'无'}</label>
							</div>
						</div>
					</div>

				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required hide">*</span> ${text('附件上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile2" bizKey="${dcSupTaskAudit.dcSupTaskFeedback.id}" bizType="dcSupTaskFeedback_file"
								uploadType="all" class="" readonly="true" preview="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row" id="yes_no_sign" style="display: none">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('签报是否报送')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:radio path="remarks4" dictType="sys_yes_no"  class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required hide">*</span></label>
							<div class="col-sm-10">
								<button class="btn btn-primary btn-sm" type="button" style="font-size: 14px"  id="batch">批量下载</button>
							</div>
						</div>
					</div>
				</div>
				<#form:hidden path="id"/>
				<#form:hidden path="targetId"/>
				<#form:hidden path="targetType"/>
				<#form:hidden path="dcSupTaskFeedback.id"/>
				<#form:hidden path="dcSupTaskFeedback.actionId"/>
				<#form:hidden path="dcSupTaskFeedback.updateBy"/>
				<div class="form-unit">${text('审核信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('审核结果')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:radio path="auditResult" dictType="dc_audit_result" defaultValue="1" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('审核意见')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="auditOption" rows="4" style="white-space: pre-line;" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('audit:dcSupTaskAudit:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('提 交')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>

	$("#feedbackRate").val('${dcSupTaskAudit.dcSupTaskFeedback.feedbackRate}')
	var taskTypeCode ='${dcSupTaskAudit.dcSupTaskInfo.taskTypeCode}'
	if(taskTypeCode=='101'){
		$("#yes_no_sign").show()
	}else {
		$("#yes_no_sign").remove();
	}

$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();

				});
			}
		}, "json");
    }
});
var dcSupTaskAudit = ${toJson(dcSupTaskAudit)}
$(function (){
 var time=	new Date().getMilliseconds();
	js.ajaxSubmit({
		url:"${ctx}/file/fileList?_t="+time +'&bizKey='+dcSupTaskAudit.dcSupTaskFeedback.id +'&bizType=dcSupTaskFeedback_file',
		callback:function (data){
			var res=JSON.parse(JSON.stringify(data));
			if (res.result == 'false'){
				$("#batch").hide();
			}else{
				$("#batch").show();
			}
		},
		async:false
	})
})
$('#auditResult').on('ifChecked', function(){
	if($('#auditResult input:radio:checked').val()=='2') {
		$('#auditOption').addClass("required")
	}else{
		$('#auditOption').removeClass("required")
	}
});
		$("#batch").click(function (){
			var list=	$("#uploadFile2").val();
			if (list == null || list == ''){
				js.showMessage("下载列表为空");
				return;
			}
			var id=	$("#id").val();
			var bizType='dcSupTaskFeedback_file';
			let xhr = new XMLHttpRequest();
			xhr.open('GET', "${ctx}/taskdeploy/dcSupTaskInfo/queryDownLoadDocument?id="+id+'&bizType='+bizType+"&jpgId="+list, true);
			xhr.setRequestHeader('Content-Type', `application/json`);
			xhr.responseType = 'blob';
			let that = this;
			xhr.onload = function () {
				if (this.status == 200) {
					//接受二进制文件流
					var blob = this.response;
					let downloadElement = document.createElement('a');
					let href = blob;
					if (typeof blob == 'string') {
						downloadElement.target = '_blank';
					} else {
						href = window.URL.createObjectURL(blob) ;//创建下载的链接
					}
					downloadElement.href = href;
					//下载后文件名
					downloadElement.download = dcSupTaskAudit.dcSupTaskInfo.taskTitle + "_"+dcSupTaskAudit.taskLeaderOrgName+".zip";
					document.body.appendChild(downloadElement)
					downloadElement.click(); //点击下载
					document.body.removeChild(downloadElement); //下载完成移除元素
					if (typeof blob != 'string') {
						window.URL.revokeObjectURL(href); //释放掉blob对象
					}
				}else{
					js.showMessage("文件导出失败");
				}
			}
			xhr.send();
		})
</script>